const deepClone = function (target) {
  if (typeof target !== "object") return target;

  let clone = Array.isArray(target) ? [] : {};

  for (let key in target) {
    if (target.hasOwnProperty(key)) {
      clone[key] = deepClone(target[key]);
    }
  }
  return clone;
};

const a = deepClone([1, 2, 3]);
const c = {
  a: 1,
  b: {
    a: 1,
    b: 2,
  },
};
const b = deepClone(c);

console.log(a, b, c, b === c);
